home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 March / PCWMAR09.iso / Software / Freeware / Adobe Media Player 1.6 / adobe_media_player.air / AMP.swf / scripts / mx / logging / LogLogger.as < prev   
Encoding:
Text File  |  2008-11-25  |  3.7 KB  |  128 lines

  1. package mx.logging
  2. {
  3.    import flash.events.EventDispatcher;
  4.    import mx.core.mx_internal;
  5.    import mx.resources.IResourceManager;
  6.    import mx.resources.ResourceManager;
  7.    
  8.    use namespace mx_internal;
  9.    
  10.    public class LogLogger extends EventDispatcher implements ILogger
  11.    {
  12.       mx_internal static const VERSION:String = "3.2.0.3958";
  13.       
  14.       private var _category:String;
  15.       
  16.       private var resourceManager:IResourceManager;
  17.       
  18.       public function LogLogger(param1:String)
  19.       {
  20.          resourceManager = ResourceManager.getInstance();
  21.          super();
  22.          _category = param1;
  23.       }
  24.       
  25.       public function log(param1:int, param2:String, ... rest) : void
  26.       {
  27.          var _loc4_:String = null;
  28.          var _loc5_:int = 0;
  29.          if(param1 < LogEventLevel.DEBUG)
  30.          {
  31.             _loc4_ = resourceManager.getString("logging","levelLimit");
  32.             throw new ArgumentError(_loc4_);
  33.          }
  34.          if(hasEventListener(LogEvent.LOG))
  35.          {
  36.             _loc5_ = 0;
  37.             while(_loc5_ < rest.length)
  38.             {
  39.                param2 = param2.replace(new RegExp("\\{" + _loc5_ + "\\}","g"),rest[_loc5_]);
  40.                _loc5_++;
  41.             }
  42.             dispatchEvent(new LogEvent(param2,param1));
  43.          }
  44.       }
  45.       
  46.       public function error(param1:String, ... rest) : void
  47.       {
  48.          var _loc3_:int = 0;
  49.          if(hasEventListener(LogEvent.LOG))
  50.          {
  51.             _loc3_ = 0;
  52.             while(_loc3_ < rest.length)
  53.             {
  54.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  55.                _loc3_++;
  56.             }
  57.             dispatchEvent(new LogEvent(param1,LogEventLevel.ERROR));
  58.          }
  59.       }
  60.       
  61.       public function warn(param1:String, ... rest) : void
  62.       {
  63.          var _loc3_:int = 0;
  64.          if(hasEventListener(LogEvent.LOG))
  65.          {
  66.             _loc3_ = 0;
  67.             while(_loc3_ < rest.length)
  68.             {
  69.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  70.                _loc3_++;
  71.             }
  72.             dispatchEvent(new LogEvent(param1,LogEventLevel.WARN));
  73.          }
  74.       }
  75.       
  76.       public function get category() : String
  77.       {
  78.          return _category;
  79.       }
  80.       
  81.       public function info(param1:String, ... rest) : void
  82.       {
  83.          var _loc3_:int = 0;
  84.          if(hasEventListener(LogEvent.LOG))
  85.          {
  86.             _loc3_ = 0;
  87.             while(_loc3_ < rest.length)
  88.             {
  89.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  90.                _loc3_++;
  91.             }
  92.             dispatchEvent(new LogEvent(param1,LogEventLevel.INFO));
  93.          }
  94.       }
  95.       
  96.       public function debug(param1:String, ... rest) : void
  97.       {
  98.          var _loc3_:int = 0;
  99.          if(hasEventListener(LogEvent.LOG))
  100.          {
  101.             _loc3_ = 0;
  102.             while(_loc3_ < rest.length)
  103.             {
  104.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  105.                _loc3_++;
  106.             }
  107.             dispatchEvent(new LogEvent(param1,LogEventLevel.DEBUG));
  108.          }
  109.       }
  110.       
  111.       public function fatal(param1:String, ... rest) : void
  112.       {
  113.          var _loc3_:int = 0;
  114.          if(hasEventListener(LogEvent.LOG))
  115.          {
  116.             _loc3_ = 0;
  117.             while(_loc3_ < rest.length)
  118.             {
  119.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  120.                _loc3_++;
  121.             }
  122.             dispatchEvent(new LogEvent(param1,LogEventLevel.FATAL));
  123.          }
  124.       }
  125.    }
  126. }
  127.  
  128.